#include "pav.h"
#include "ui_pav.h"
#include <QDebug>

Pav::Pav(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Pav)
{
    ui->setupUi(this);

    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(checkOs()));
    connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(checkOs()));
    connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT(checkOs()));
    connect(ui->pushButton_4, SIGNAL(clicked()), this, SLOT(checkOs()));
    connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(checkOs()));
    connect(ui->pushButton_6, SIGNAL(clicked()), this, SLOT(checkOs()));
    connect(ui->pushButton_7, SIGNAL(clicked()), this, SLOT(checkOs()));
    connect(ui->pushButton_8, SIGNAL(clicked()), this, SLOT(checkOs()));
    connect(ui->pushButton_9, SIGNAL(clicked()), ui->lineEdit, SLOT(clear()));
    connect(ui->pushButton_10, SIGNAL(clicked()), this, SLOT(checkOs()));
}

Pav::~Pav()
{
    delete ui;
}

void Pav::changeEvent(QEvent *e)
{
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void Pav::checkOs()
{
    QMessageBox messageBox(this);
    messageBox.setIcon(QMessageBox::Critical);
    utsname buf;
    if(!uname(&buf))
    {
        if(!QString(buf.sysname).compare("BolgenOS"))
            void(); // тут даем добро на запуск антивируса
        else
            QMessageBox::critical(0, trUtf8("Ахтунг!"), trUtf8("Ваша операционная система\nне BolgenOS!"));
    }
}
